Optimal. Leaf size=47 \[ \frac {\tanh ^{-1}(\sin (x))}{a}+\frac {b \tanh ^{-1}\left (\frac {a \cos (x)-b \sin (x)}{\sqrt {a^2+b^2}}\right )}{a \sqrt {a^2+b^2}} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.08, antiderivative size = 47, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 5, integrand size = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.454, Rules used = {3599, 3189,
3855, 3153, 212} \begin {gather*} \frac {b \tanh ^{-1}\left (\frac {a \cos (x)-b \sin (x)}{\sqrt {a^2+b^2}}\right )}{a \sqrt {a^2+b^2}}+\frac {\tanh ^{-1}(\sin (x))}{a} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 212
Rule 3153
Rule 3189
Rule 3599
Rule 3855
Rubi steps
\begin {align*} \int \frac {\sec (x)}{a+b \cot (x)} \, dx &=-\int \frac {\tan (x)}{-b \cos (x)-a \sin (x)} \, dx\\ &=-\int \left (-\frac {\sec (x)}{a}+\frac {b}{a (b \cos (x)+a \sin (x))}\right ) \, dx\\ &=\frac {\int \sec (x) \, dx}{a}-\frac {b \int \frac {1}{b \cos (x)+a \sin (x)} \, dx}{a}\\ &=\frac {\tanh ^{-1}(\sin (x))}{a}+\frac {b \text {Subst}\left (\int \frac {1}{a^2+b^2-x^2} \, dx,x,a \cos (x)-b \sin (x)\right )}{a}\\ &=\frac {\tanh ^{-1}(\sin (x))}{a}+\frac {b \tanh ^{-1}\left (\frac {a \cos (x)-b \sin (x)}{\sqrt {a^2+b^2}}\right )}{a \sqrt {a^2+b^2}}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.10, size = 76, normalized size = 1.62 \begin {gather*} \frac {-\frac {2 b \tanh ^{-1}\left (\frac {-a+b \tan \left (\frac {x}{2}\right )}{\sqrt {a^2+b^2}}\right )}{\sqrt {a^2+b^2}}-\log \left (\cos \left (\frac {x}{2}\right )-\sin \left (\frac {x}{2}\right )\right )+\log \left (\cos \left (\frac {x}{2}\right )+\sin \left (\frac {x}{2}\right )\right )}{a} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.37, size = 63, normalized size = 1.34
method | result | size |
default | \(-\frac {\ln \left (\tan \left (\frac {x}{2}\right )-1\right )}{a}+\frac {\ln \left (\tan \left (\frac {x}{2}\right )+1\right )}{a}+\frac {2 b \arctanh \left (\frac {-2 b \tan \left (\frac {x}{2}\right )+2 a}{2 \sqrt {a^{2}+b^{2}}}\right )}{a \sqrt {a^{2}+b^{2}}}\) | \(63\) |
risch | \(\frac {b \ln \left ({\mathrm e}^{i x}-\frac {i b -a}{\sqrt {a^{2}+b^{2}}}\right )}{\sqrt {a^{2}+b^{2}}\, a}-\frac {b \ln \left ({\mathrm e}^{i x}+\frac {i b -a}{\sqrt {a^{2}+b^{2}}}\right )}{\sqrt {a^{2}+b^{2}}\, a}+\frac {\ln \left ({\mathrm e}^{i x}+i\right )}{a}-\frac {\ln \left ({\mathrm e}^{i x}-i\right )}{a}\) | \(109\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] Leaf count of result is larger than twice the leaf count of optimal. 98 vs.
\(2 (43) = 86\).
time = 0.50, size = 98, normalized size = 2.09 \begin {gather*} \frac {b \log \left (\frac {a - \frac {b \sin \left (x\right )}{\cos \left (x\right ) + 1} + \sqrt {a^{2} + b^{2}}}{a - \frac {b \sin \left (x\right )}{\cos \left (x\right ) + 1} - \sqrt {a^{2} + b^{2}}}\right )}{\sqrt {a^{2} + b^{2}} a} + \frac {\log \left (\frac {\sin \left (x\right )}{\cos \left (x\right ) + 1} + 1\right )}{a} - \frac {\log \left (\frac {\sin \left (x\right )}{\cos \left (x\right ) + 1} - 1\right )}{a} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 140 vs.
\(2 (43) = 86\).
time = 3.87, size = 140, normalized size = 2.98 \begin {gather*} \frac {\sqrt {a^{2} + b^{2}} b \log \left (\frac {2 \, a b \cos \left (x\right ) \sin \left (x\right ) - {\left (a^{2} - b^{2}\right )} \cos \left (x\right )^{2} - a^{2} - 2 \, b^{2} - 2 \, \sqrt {a^{2} + b^{2}} {\left (a \cos \left (x\right ) - b \sin \left (x\right )\right )}}{2 \, a b \cos \left (x\right ) \sin \left (x\right ) - {\left (a^{2} - b^{2}\right )} \cos \left (x\right )^{2} + a^{2}}\right ) + {\left (a^{2} + b^{2}\right )} \log \left (\sin \left (x\right ) + 1\right ) - {\left (a^{2} + b^{2}\right )} \log \left (-\sin \left (x\right ) + 1\right )}{2 \, {\left (a^{3} + a b^{2}\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\sec {\left (x \right )}}{a + b \cot {\left (x \right )}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 90 vs.
\(2 (43) = 86\).
time = 0.44, size = 90, normalized size = 1.91 \begin {gather*} \frac {b \log \left (\frac {{\left | 2 \, b \tan \left (\frac {1}{2} \, x\right ) - 2 \, a - 2 \, \sqrt {a^{2} + b^{2}} \right |}}{{\left | 2 \, b \tan \left (\frac {1}{2} \, x\right ) - 2 \, a + 2 \, \sqrt {a^{2} + b^{2}} \right |}}\right )}{\sqrt {a^{2} + b^{2}} a} + \frac {\log \left ({\left | \tan \left (\frac {1}{2} \, x\right ) + 1 \right |}\right )}{a} - \frac {\log \left ({\left | \tan \left (\frac {1}{2} \, x\right ) - 1 \right |}\right )}{a} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 0.66, size = 408, normalized size = 8.68 \begin {gather*} \frac {2\,\mathrm {atanh}\left (\mathrm {tan}\left (\frac {x}{2}\right )\right )}{a}-\frac {2\,b\,\mathrm {atanh}\left (\frac {64\,b^3}{\sqrt {a^2+b^2}\,\left (128\,b^2\,\mathrm {tan}\left (\frac {x}{2}\right )-\frac {128\,b^4\,\mathrm {tan}\left (\frac {x}{2}\right )}{a^2+b^2}+\frac {64\,a\,b^3}{a^2+b^2}\right )}-\frac {64\,b^5}{{\left (a^2+b^2\right )}^{3/2}\,\left (128\,b^2\,\mathrm {tan}\left (\frac {x}{2}\right )-\frac {128\,b^4\,\mathrm {tan}\left (\frac {x}{2}\right )}{a^2+b^2}+\frac {64\,a\,b^3}{a^2+b^2}\right )}+\frac {128\,b^4\,\mathrm {tan}\left (\frac {x}{2}\right )}{\sqrt {a^2+b^2}\,\left (\frac {64\,a^2\,b^3}{a^2+b^2}+128\,a\,b^2\,\mathrm {tan}\left (\frac {x}{2}\right )-\frac {128\,a\,b^4\,\mathrm {tan}\left (\frac {x}{2}\right )}{a^2+b^2}\right )}-\frac {128\,b^6\,\mathrm {tan}\left (\frac {x}{2}\right )}{{\left (a^2+b^2\right )}^{3/2}\,\left (\frac {64\,a^2\,b^3}{a^2+b^2}+128\,a\,b^2\,\mathrm {tan}\left (\frac {x}{2}\right )-\frac {128\,a\,b^4\,\mathrm {tan}\left (\frac {x}{2}\right )}{a^2+b^2}\right )}+\frac {128\,a\,b^2\,\mathrm {tan}\left (\frac {x}{2}\right )}{\sqrt {a^2+b^2}\,\left (128\,b^2\,\mathrm {tan}\left (\frac {x}{2}\right )-\frac {128\,b^4\,\mathrm {tan}\left (\frac {x}{2}\right )}{a^2+b^2}+\frac {64\,a\,b^3}{a^2+b^2}\right )}-\frac {192\,a\,b^4\,\mathrm {tan}\left (\frac {x}{2}\right )}{{\left (a^2+b^2\right )}^{3/2}\,\left (128\,b^2\,\mathrm {tan}\left (\frac {x}{2}\right )-\frac {128\,b^4\,\mathrm {tan}\left (\frac {x}{2}\right )}{a^2+b^2}+\frac {64\,a\,b^3}{a^2+b^2}\right )}\right )}{a\,\sqrt {a^2+b^2}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________